//package com.atguigu.lease.web.admin.custom.converter;
//
//import com.atguigu.lease.model.enums.ItemType;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.core.convert.converter.Converter;
//import org.springframework.stereotype.Component;
//
///**
// * @program: lease
// * @description: Java Lotus
// * @author: spring
// * @create: 2024-09-24
// */
//
//@Component
//public class StringToItemTypeConverter implements Converter<String, ItemType> {
//
//
//    @Override
//    public ItemType convert(String code) {
////        if ("1".equals(code)){
////            return ItemType.APARTMENT;
////        }else if ("2".equals(code)){
////            return ItemType.ROOM;
////        }
////        ItemType.class.getEnumConstants();
//        ItemType[] values = ItemType.values();
//        for (ItemType itemType : values) {
//            if (itemType.getCode().equals(Integer.valueOf(code))){
//                return itemType;
//            }
//        }
//        throw new IllegalArgumentException("code:"+code+"非法");
//    }
//}
